<template>
	
	<view v-for="(item) in dataObj">
		<view v-if="item.mode==1">
			<CardViewText :title=item.title :isTop="item.isTop" :author="item.author" :evaluation="item.evaluation" >
				<template #tips v-if="item.showSearch">
					<view class="search">
						<text>搜索：</text>
						<view>
							<text>今日金价</text>
						</view>
						<view>
							<text>精选好物</text>
						</view>
					</view>
				</template>
			</CardViewText>
		</view>
		<view v-else-if="item.mode==2">
			<newsView :title=item.title :isTop="item.isTop" :author="item.author" :evaluation="item.evaluation" :imgUrl="item.imgUrl"></newsView>
		</view>
		<view v-else-if="item.mode==3">
			<Advertisement :title=item.title :isTop="item.isTop" :author="item.author" :imgUrl="item.imgUrl"></Advertisement>
		</view>

	</view>
</template>

<script>
import CardViewText from "../../../components/CardViewText.vue"
import newsView from "../../../components/NewsCardView.vue";
import Advertisement from "../../../components/Adment.vue";
import newsData from "@/Data/news.json";

export default {
  components: {
    CardViewText,
    newsView,
    Advertisement
  },
  data() {
    return {
      dataObj: newsData 
    }
  },
  methods: {

  }
}
</script>

<style>
	.search{
		display: flex;
		font-size: 24rpx;
		color: blue;
	}
	.search>view:not(:last-child) {
		/* 固定间隔值 */
		margin-right: 10px;
	}
</style>